import Vue from "vue";
import App from "./App.vue";
import axios from "axios";
import router from './router/router.js'

Vue.config.productionTip = false;
Vue.prototype.$http = axios; //先要引用
//axios拦截器:请求拦截器
axios.interceptors.request.use(function (config) {
  console.log("请求拦截", config);
  config["headers"]["Authorization"] =
    "Bearer " + localStorage.getItem("token");
  return config;
});
//返还拦截器
axios.interceptors.response.use((res) => {
  console.log("返还拦截器", res);
  return res;
});
new Vue({
  router,
  render: (h) => h(App),
}).$mount("#app");
